package actioncombination.logic.agent;

import actioncombination.logic.agent.action.Action;
import actioncombination.logic.agent.GoalTest;
import actioncombination.logic.agent.AgentState;
import actioncombination.problem.gridworld.GoalTestImpl;
import actioncombination.logic.environment.Environment;
import actioncombination.logic.rlmethod.RLMethodStrategy;
import java.util.Vector;

/**
 * @author Jorge M. Roa
 * @version 1.0
 * @created 08-Mar-2007 13:16:04
 */
public abstract class GoalBasedAgent extends Agent {

    protected AgentState state;
    protected Vector<Action> actions;
    protected GoalTest goal;
    protected Environment environment;

    public GoalBasedAgent() {
    }

    public void see(Perception p) {
        //problem.getAgentState().updateState(p);
        //this.getAgentState().updateState(p);
    }

    public AgentState getAgentState() {
        return state;
    }

    public void setAgentState(AgentState agentState) {
        this.state = agentState;
    }

    public AgentState getState() {
        return state;
    }

    public void setState(AgentState state) {
        this.state = state;
    }

    public Vector<Action> getActions() {
        return actions;
    }

    public void setActions(Vector<Action> actions) {
        this.actions = actions;
    }

    public GoalTest getGoal() {
        return goal;
    }

    public void setGoal(GoalTest goal) {
        this.goal = goal;
    }
    
    public AgentState execute(Action a){
        return this.getActions().get(this.getActions().indexOf(a)).execute(this.getAgentState());
    }

    public Environment getEnvironment() {
        return environment;
    }

    public void setEnvironment(Environment environment) {
        this.environment = environment;
    }
            
}